package com.ulic.customerManApplication.commonmodule.bo;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name = "T_GYW_MENU")
@SequenceGenerator(name="menu_seq",sequenceName="S_GYW_MENU_ID")
public class Menu implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int oid;
	// 编号
	private String code;
	// 名称
	private String name;
	// 排序
	private int sequence;
	// 功能点
	private Set<Function> functions = new HashSet<Function>();

	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="menu_seq")
	public int getOid() {
		return oid;
	}

	public void setOid(int oid) {
		this.oid = oid;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getSequence() {
		return sequence;
	}

	public void setSequence(int sequence) {
		this.sequence = sequence;
	}

	@OneToMany(targetEntity = Function.class, mappedBy = "menu")	
	@OrderBy("oid asc")
	public Set<Function> getFunctions() {
		return functions;
	}

	public void setFunctions(Set<Function> functions) {
		this.functions = functions;
	}
}
